export const setDesignResolution = () => {
    const canvas = cc.find("Canvas").getComponent(cc.Canvas);
    const frameSize = cc.view.getFrameSize();
    const designSize = cc.view.getDesignResolutionSize();
    if (frameSize.width / frameSize.height <= designSize.width / designSize.height) {
        canvas.fitWidth = false;
        canvas.fitHeight = true;
    } else {
        canvas.fitWidth = true;
        canvas.fitHeight = false;
    }
};

export const setUIResolution = (nodes: cc.Node | cc.Node[]) => {
    if (!nodes) return;
    if (nodes instanceof cc.Node) nodes = [nodes];
    const frameSize = cc.view.getFrameSize();
    const designSize = cc.view.getDesignResolutionSize();
    const UIScale = (frameSize.width / frameSize.height) / (designSize.width / designSize.height);
    cc.log(UIScale)
    nodes.forEach(v => v.scale = UIScale);
};
